<?Lassoscript
// Tag Name: 'li_yesterday_hour', version 1.0
	// Created by: Eric Landmann, Landmann InterActive, elandmann@landmanninteractive.com
	// 11/27/2005
	// Lasso Professional 8-compatible
	// This tag compares a date in a MySQL database date field
	// and outputs one of four possibilities:
	// 1. Outputs "Today" if the database date is the same as the server date
	// 2. Outputs "Yesterday" if the database date compared to the server date is
	//      the day before
	// 3. Outputs a date formatted in U.S. style if the database date
	//		and the server date are the same
	// 4. Outputs nothing if no records are found
	// Possible uses might be for a calendar or bulletin board
	//
	// Usage: [li_yesterday_hour: -dbDate=(Field:'YourDate')]
	// Specifying the tag with no -dbDate will result in no output
	//
	// Change Notes 11/27/2005
	// Now compares dates based on number of hours difference instead of days

If: !(Lasso_TagExists: 'li_yesterday_hour');

	Define_Tag: 'li_yesterday_hour', -Required = 'dbDate';
		Local:'Result' = String;	
		Local:'CheckDate' = (Date_Difference:(date),(Date:(#dbDate)),-Hour);
		
		If: (#CheckDate) < '24';
			#Result = '<font color="#FF0000"><b>Today</b></font>';
		Else: ((#CheckDate) > '24') && ((#CheckDate) < '48');
			#Result = '<font color="#FF0000"><b>Yesterday</b></font>';
		Else: ((#CheckDate) > '48') && ((#CheckDate) < '72');
			#Result = '<font color="#FF0000"><b>Two Days Ago</b></font>';
		Else;
			#Result = #dbDate;
		/If;
	
		Return: Encode_Smart:(#Result);

	/Define_Tag;

/If;
?>
